<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>志愿服务管理系统 - 超级管理员</title>
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <script src="/static/js/sockjs.min.js"></script>
    <script src="/static/js/stomp.min.js"></script>
    <style>
        :root {
            --primary-color: #337ab7;
            --hover-color: #286090;
            --text-color: #ffffff;
            --bg-gradient: linear-gradient(145deg, var(--primary-color), var(--hover-color));
            --shadow: 0 2px 10px rgba(0,0,0,0.1);
            --transition: all 0.3s ease;
            --border-radius: 10px;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
            margin: 0;
            padding: 0;
            min-height: 100vh;
        }

        .sidebar {
            background: var(--bg-gradient);
            width: 280px;
            height: 100vh;
            position: fixed;
            top: 0;
            left: 0;
            overflow-y: auto;
            box-shadow: var(--shadow);
            transition: var(--transition);
            z-index: 1000;
        }

        .sidebar::-webkit-scrollbar {
            width: 6px;
        }

        .sidebar::-webkit-scrollbar-track {
            background: rgba(255,255,255,0.1);
        }

        .sidebar::-webkit-scrollbar-thumb {
            background: rgba(255,255,255,0.3);
            border-radius: 3px;
        }

        .sidebar-header {
            padding: 20px;
            text-align: center;
            border-bottom: 1px solid rgba(255,255,255,0.1);
        }

        .sidebar-title {
            color: var(--text-color);
            font-size: 1.5rem;
            margin: 0;
            font-weight: 600;
        }

        .sidebar a {
            display: flex;
            align-items: center;
            padding: 15px 20px;
            color: var(--text-color);
            text-decoration: none;
            transition: var(--transition);
            border-left: 4px solid transparent;
        }

        .sidebar a i {
            margin-right: 10px;
            width: 24px;
            text-align: center;
            font-size: 1.1rem;
        }

        .sidebar a:hover {
            background: rgba(255,255,255,0.1);
            border-left-color: #fff;
            transform: translateX(5px);
        }

        .sidebar .dropdown > a {
            justify-content: space-between;
        }

        .sidebar .dropdown > a::after {
            content: '\f107';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            transition: var(--transition);
        }

        .sidebar .dropdown.active > a::after {
            transform: rotate(180deg);
        }

        .sidebar .dropdown-content {
            display: none;
            background: rgba(0,0,0,0.1);
            padding: 5px 0;
        }

        .sidebar .dropdown-content a {
            padding: 12px 25px 12px 54px;
            font-size: 0.95rem;
            opacity: 0.9;
        }

        .content {
            margin-left: 280px;
            padding: 30px;
            transition: var(--transition);
        }

        .page-header {
            background: white;
            padding: 25px;
            border-radius: var(--border-radius);
            box-shadow: var(--shadow);
            margin-bottom: 30px;
        }

        .page-title {
            color: var(--primary-color);
            margin: 0 0 20px 0;
            font-size: 2rem;
            font-weight: 600;
        }

        .btn-custom {
            padding: 10px 24px;
            border-radius: 6px;
            transition: var(--transition);
            margin: 0 8px;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            font-weight: 500;
        }

        .btn-custom i {
            font-size: 1.1rem;
        }

        .btn-custom:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.15);
        }

        .action-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
        }

        @media (max-width: 768px) {
            .sidebar {
                transform: translateX(-100%);
                width: 250px;
            }

            .sidebar.active {
                transform: translateX(0);
            }

            .content {
                margin-left: 0;
            }

            .menu-toggle {
                display: block;
            }

            .action-buttons {
                flex-direction: column;
            }

            .btn-custom {
                width: 100%;
                justify-content: center;
            }
        }

        .menu-toggle {
            display: none;
            position: fixed;
            top: 15px;
            left: 15px;
            z-index: 1001;
            background: var(--primary-color);
            color: white;
            border: none;
            padding: 10px;
            border-radius: 5px;
            cursor: pointer;
            box-shadow: var(--shadow);
        }

        /* 添加动画效果 */
        .fade-in {
            animation: fadeIn 0.3s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }
    </style>
</head>
<body>

<button class="menu-toggle">
    <i class="fas fa-bars"></i>
</button>

<div class="sidebar">
    <div class="sidebar-header">
        <h1 class="sidebar-title">志愿服务管理系统</h1>
    </div>

    <a href="#"><i class="fas fa-home"></i>首页</a>

    <div class="dropdown">
        <a><i class="fas fa-user-circle"></i>个人中心</a>
        <div class="dropdown-content">
            <a href="#" th:href="@{/adminInfo}"><i class="fas fa-id-card"></i>个人信息</a>
            <a href="#" th:href="@{/updateAdminPwdPage}"><i class="fas fa-key"></i>修改密码</a>
        </div>
    </div>

    <div class="dropdown">
        <a><i class="fas fa-users-cog"></i>管理员管理</a>
        <div class="dropdown-content">
            <a href="#" th:href="@{/addPage}"><i class="fas fa-user-plus"></i>添加管理员</a>
            <a th:href="@{/adminList}"><i class="fas fa-list"></i>查询管理员</a>
        </div>
    </div>

    <div class="dropdown">
        <a><i class="fas fa-user-friends"></i>用户管理</a>
        <div class="dropdown-content">
            <a href="#" th:href="@{/toAddPage}"><i class="fas fa-user-plus"></i>添加用户</a>
            <a href="#" th:href="@{/userList}"><i class="fas fa-list"></i>查询用户</a>
        </div>
    </div>

    <div class="dropdown">
        <a><i class="fas fa-calendar-alt"></i>活动管理</a>
        <div class="dropdown-content">
            <a href="#" th:href="@{/toAddActivityPage}"><i class="fas fa-plus-circle"></i>发布活动</a>
            <a href="#" th:href="@{/toActivityList}"><i class="fas fa-list-alt"></i>活动列表</a>
        </div>
    </div>

    <div class="dropdown">
        <a><i class="fas fa-clipboard-check"></i>签到管理</a>
        <div class="dropdown-content">
            <a href="/toSignList"><i class="fas fa-history"></i>签到记录</a>
        </div>
    </div>

    <div class="dropdown">
        <a><i class="fas fa-bullhorn"></i>公告通知管理</a>
        <div class="dropdown-content">
            <a href="#" th:href="@{/publishAnnouncement}"><i class="fas fa-plus"></i>发布公告</a>
            <a href="#" th:href="@{/notificationManagement}"><i class="fas fa-bell"></i>通知管理</a>
        </div>
    </div>

    <div class="dropdown">
        <a><i class="fas fa-user-shield"></i>用户管理</a>
        <div class="dropdown-content">
            <a href="#" th:href="@{/userList}"><i class="fas fa-users"></i>用户列表</a>
            <a href="#" th:href="@{/userPermissions}"><i class="fas fa-user-lock"></i>用户权限</a>
        </div>
    </div>


</div>

<div class="content">
    <div class="container-fluid">
        <div class="page-header fade-in">
            <h2 class="page-title">欢迎使用志愿服务管理系统</h2>
            <div class="action-buttons">
                <button class="btn btn-primary btn-custom" th:onclick="|window.location.href='@{/search}'|">
                    <i class="fas fa-search"></i>查询
                </button>
                <button class="btn btn-success btn-custom" th:onclick="|window.location.href='@{/add}'|">
                    <i class="fas fa-plus"></i>新增
                </button>
                <button class="btn btn-danger btn-custom" th:onclick="|window.location.href='@{/delete}'|">
                    <i class="fas fa-trash"></i>删除
                </button>
            </div>
        </div>
    </div>
</div>

<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script th:inline="javascript">
    // 侧边栏交互
    document.querySelectorAll('.dropdown').forEach(function(drop) {
        drop.addEventListener('click', function(e) {
            e.stopPropagation();
            this.classList.toggle('active');
            const content = this.querySelector('.dropdown-content');
            const allDropdowns = document.querySelectorAll('.dropdown-content');

            allDropdowns.forEach(dropdown => {
                if (dropdown !== content) {
                    dropdown.style.display = 'none';
                }
            });

            content.style.display = content.style.display === 'block' ? 'none' : 'block';
        });
    });

    // 点击外部关闭下拉菜单
    document.addEventListener('click', function(e) {
        if (!e.target.closest('.dropdown')) {
            document.querySelectorAll('.dropdown-content').forEach(dropdown => {
                dropdown.style.display = 'none';
            });
        }
    });

    // 移动端菜单切换
    const menuToggle = document.querySelector('.menu-toggle');
    const sidebar = document.querySelector('.sidebar');

    menuToggle.addEventListener('click', function() {
        sidebar.classList.toggle('active');
    });

    // WebSocket连接
    var stompClient = null;
    var mobile = [[${mobile}]];

    function connect() {
        var socket = new SockJS('/ws?mobile=' + encodeURIComponent(mobile));
        stompClient = Stomp.over(socket);
        stompClient.connect({}, function(frame) {
            console.log('Connected: ' + frame);
        });
    }

    window.onload = connect;
</script>

</body>
</html>